#pragma  once
#include "..\IDataSet.h"
#include <vector>
#include "TestData.h"
#include "..\..\Content\ThreadManager.h"
namespace DataManager
{


class  TestDataSetUnion:public IDataSetUnion
{
public:
	TestDataSetUnion(): index_(-1)		
	{
		using  Content::ThreadManager;
		data_set_ = new RealTimeDataSet;
		test_ = new  RealTimeDataSetTest;
		MessageLoopForIO * io_loop = 
			static_cast<MessageLoopForIO*>(ThreadManager::GetInstance()->GetThreadMessageLoop(ThreadManager::IO_THREAD));
		test_->SetUp( io_loop, data_set_.get() );
		test_->BeginCollectData( data_set_.get() );
		data_set_list_.push_back( data_set_.get() );
	}

	virtual bool   HasNextDataSet()			{	return index_+1 < static_cast<int>(data_set_list_.size());	}
	virtual IDataSet*	GetNextDataSet()	{	return data_set_list_[++index_];			}
	virtual void   Reset()					{	index_ = -1;			}
	virtual  DataType GetDataType()			{	return  REALTIME_DATA_TYPE;	}
 
private:
	std::vector<IDataSet*>	data_set_list_;
	int						index_;
	scoped_refptr<RealTimeDataSetTest>		test_;
	scoped_refptr<RealTimeDataSet>			data_set_;
};
}